package com.xiaomaoaixue.system.api;

import com.xiaomaoaixue.common.core.web.domain.AjaxResult;
import com.xiaomaoaixue.system.api.domain.SysUser;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.xiaomaoaixue.common.core.constant.ServiceNameConstants;
import com.xiaomaoaixue.common.core.domain.R;
import com.xiaomaoaixue.system.api.factory.RemoteUserFallbackFactory;
import com.xiaomaoaixue.system.api.model.LoginUser;

import java.util.List;

/**
 * 用户服务
 * 
 * @author xiaomaoaixue
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @return 结果
     */
    @GetMapping(value = "/user/info/{username}")
    public R<LoginUser> getUserInfo(@PathVariable("username") String username);


    /**
     * 一键同步所有用户
     * @param userList
     * @return
     */
    @PostMapping("/user/syncWeUser")
    public AjaxResult syncWeUser(@RequestBody List<SysUser> userList);

    /**
     * 增量同步用户
     * @param user 用户
     * @param type 类型：增删改？BusinessType
     * @return
     */
    @PostMapping("/user/weCallBackSysUser")
    public AjaxResult weCallBackSysUser(@RequestBody SysUser user, @RequestParam("type") String type);

}
